package org.xy.utils;

import java.io.IOException;

public class CMDCaller {
	public static final String POST_CLOSE_WINDOW = "cmd /c dir ";
	public static final String POST_NONCLOSE_WINDOW = "cmd /k dir ";
	public static final String PRE_NEW_AND_CLOSE_ORIGINAL_WINDOW = "cmd /c start dir ";
	public static final String PRE_NEW_AND_NONCLOSE_ORIGINAL_WINDOW = "cmd /k start dir ";

	/**
	 * cmd /c dir 是执行完dir命令后关闭命令窗口。 cmd /k dir 是执行完dir命令后不关闭命令窗口。 cmd /c start
	 * dir 会打开一个新窗口后执行dir指令，原窗口会关闭。 cmd /k start dir 会打开一个新窗口后执行dir指令，原窗口不会关闭。
	 * 
	 * @param commond
	 * @throws IOException
	 */
	public static void callCMD(String commandType, String command)
			throws IOException {
		Runtime.getRuntime().exec(commandType + command);
	}
}
